import React,{ useContext } from 'react'

import { moneyContext } from "../context/index"

export default function GrandSon(props) {
  const money = useContext(moneyContext)  //  跨组件传值
  return (
    <div>
      GrandSon LayOut传过来的值： {money}
    </div>
  )
}

// import React, { Component } from 'react'

// import { moneyContext } from "../context/index"

// export default class GrandSon extends Component {
//     static contextType = moneyContext
//   render() {
//     console.log("777:", this.props, this.state)
//     return (
//       <div>
//         GrandSon  
//           ---- {this.contextType}
//       </div>
//     )
//   }
// }
